package com.animee.jiujiangdict.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class PatternUtils {
    /**
     * 剔除数字
     * @param value
     */
    public static String removeDigital(String value){
        Pattern p = Pattern.compile("[\\d]");
        Matcher matcher = p.matcher(value);
        String result = matcher.replaceAll("");
        return result;
    }
    /**
     * 剔除字母
     * @param value
     */
    public static String removeLetter(String value){
        Pattern p = Pattern.compile("[a-zA-z]");
        Matcher matcher = p.matcher(value);
        String result = matcher.replaceAll("");
        return result;
    }

    /**
     * 剔除标点符号
     * @param value
     */
    public static String removePunctuation(String value){
        Pattern p = Pattern.compile("[∶`~!@#$%^&*()+=|{}':;',\\\\[\\\\].<>/?~！@#￥%……& amp;*（）——+|{}【】‘；：”“’。，、？|]");
        Matcher matcher = p.matcher(value);
        String result = matcher.replaceAll("");
        return result;
    }

    /*提出全部字母，数字和标点符号*/
    public static String removeAll(String value){
        Pattern p = Pattern.compile("[`~!@#$%^&*()+=|{}':;',\\\\[\\\\].<>/?~！@#￥%……& amp;*（）——+|{}【】‘；：”“’。，、？|a-zA-z\\d]");
        Matcher matcher = p.matcher(value);
        String result = matcher.replaceAll("");
        return result;
    }
}
